module CustomersHelper
  
  def options_of_phones_type_names
    [['办公','办公'],['传真','传真'],['手机','手机'],['家庭','家庭'],['其他','其他']]
  end
  
  def options_of_emails_address_type_names
    [['办公','办公'],['个人','个人'],['其他','其他']]
  end
  
  def options_of_web_sites_type_names
    [['公司','公司'],['单位','单位'],['个人','个人'],['微博','微博'],['博客','博客'],['其他','其他']]
  end
  
  def options_of_ims_type_names
    [['QQ','QQ'],['MSN','MSN'],['GTALK','GTALK'],['其他','其他']]
  end

  def customer_phone_html_template(f)
    fields_js = f.fields_for :phones, ContactWay::Phone.new, :child_index => "NEW_RECORD" do |pf|
      render :partial => 'phone_in_form.html', :locals => { :phone => ContactWay::Phone.new, :pf => pf }      
    end
  end

  def customer_email_html_template(f)
    fields_js = f.fields_for :emails, ContactWay::Email.new, :child_index => "NEW_RECORD" do |pf|
      render :partial => 'email_in_form.html', :locals => { :email => ContactWay::Email.new, :pf => pf }      
    end
  end

  def customer_im_html_template(f)
    fields_js = f.fields_for :ims, ContactWay::Im.new, :child_index => "NEW_RECORD" do |pf|
      render :partial => 'im_in_form.html', :locals => { :im => ContactWay::Im.new, :pf => pf }      
    end
  end

  def customer_web_site_html_template(f)
    fields_js = f.fields_for :web_sites, ContactWay::WebSite.new, :child_index => "NEW_RECORD" do |pf|
      render :partial => 'web_site_in_form.html', :locals => { :web_site => ContactWay::WebSite.new, :pf => pf }      
    end
  end

  def customer_address_html_template(f)
    fields_js = f.fields_for :addresses, ContactWay::Address.new, :child_index => "NEW_RECORD" do |pf|
      render :partial => 'address_in_form.html', :locals => { :address => ContactWay::Address.new, :pf => pf }      
    end
  end
end
